package d7_tz;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * 2024/6/28 Cjj 乐观锁 8：20
 */
public class MyRunnable2 implements Runnable{
    //整数修改的乐观锁:原子类实现的
    private AtomicInteger count=new AtomicInteger();

    @Override
    public void run() {
        for (int i = 0; i <100 ; i++) {
            System.out.println(Thread.currentThread().getName()+
                   "count =====>"+count.incrementAndGet() );

        }
    }
}
